import {v4} from 'uuid'
//获取用户临时Id
export function getUserTempId(){
    //本地存储是否已有
    const userTempId=localStorage.getItem('USER_TEMP_ID');
    if(userTempId){
        return userTempId;
    }else{
        //生成新的临时Id
        const newUserTempId=v4()
        localStorage.setItem('USER_TEMP_ID',newUserTempId);
        return newUserTempId;
    }

}
//获取token
export function getUserToken(){
    return localStorage.getItem('USER_TOKEN')||'';
}
//保存token
export function saveUserToken(token) {
    localStorage.setItem('USER_TOKEN',token);
}
//删除token
export function deleteUserToken() {
    localStorage.removeItem('USER_TOKEN')
}